var timeTaken = 60.0;
private var textMeshComponent;


// store the text component so that GetComponent isn't called every frame

function Start() {

	textMeshComponent = GetComponent("TextMesh");
}

// update is called every frame
function Update() {
	var intTime : int = timeTaken;
	var minutes : int = intTime / 60;
	var seconds : int = intTime % 60;
	var fraction : int = timeTaken * 100;
	fraction = fraction % 100;
	var timer : String = String.Format("{0:00}:{1:00}.{2:00}", minutes, seconds, fraction); //Timer formatting
	
	// add amount of time since last frame to the totalTime
	timeTaken -= Time.deltaTime;
	
	if (timeTaken <= 0.0) {
		timeTaken = 0.0;
		Application.LoadLevel(5);
	}
	
	// use substring to get a shorter numerical value
	textMeshComponent.text = timer.ToString();


}